package org.batatasframework.support.definition.impl;

import org.batatasframework.support.database.DatabaseType;
import org.batatasframework.support.database.metadatas.FieldMetadata;
import org.batatasframework.support.database.metadatas.TableMetadata;
import org.batatasframework.support.database.sql.field.SelectFragment;
import org.batatasframework.support.database.sql.spi.TableCriterion;
import org.batatasframework.support.definition.FieldDefinition;

public class ProxyFieldDefinition implements FieldDefinition{
	
	private final String key;
	private final FieldDefinition sourceFieldDefinition;
	
	public ProxyFieldDefinition(String key, FieldDefinition sourceFieldDefinition){
		this.key = key;
		this.sourceFieldDefinition = sourceFieldDefinition;
	}

	public String getKey() {
		return key;
	}

	public String[] getGroup() {
		return sourceFieldDefinition.getGroup();
	}

	public SelectFragment buildFragment(TableCriterion tableCriterion)
			throws Exception {
		return sourceFieldDefinition.buildFragment(tableCriterion);
	}

	public String getName() {
		return sourceFieldDefinition.getName();
	}

	@Override
	public String getcolumnName() {
		return sourceFieldDefinition.getcolumnName();
	}
	public DatabaseType getDataType() {
		return sourceFieldDefinition.getDataType();
	}

	public boolean enabled() {
		return sourceFieldDefinition.enabled();
	}

	public TableMetadata getTableMetadata() {
		return sourceFieldDefinition.getTableMetadata();
	}

	public boolean contains(FieldMetadata fieldMetadata) {
		return sourceFieldDefinition.contains(fieldMetadata);
	}

	public String getTitle() {
		return sourceFieldDefinition.getTitle();
	}

	public Object getFormat() {
		return sourceFieldDefinition.getFormat();
	}

	public int getOrdinal() {
		return sourceFieldDefinition.getOrdinal();
	}

	public boolean isMustDiaplay() {
		return sourceFieldDefinition.isMustDiaplay();
	}

	@Override
	public Boolean unGroup() {
		// TODO Auto-generated method stub
		return sourceFieldDefinition.unGroup();
	}
}
